import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
#读取图形
img1=cv.imread('F:\\11\\16.png',1)
rows,cols=img1.shape[:2]
def read():
    img=cv.imread('F:\\11\\16.png',1)
    return img
def show(img):#利用opencv显示图像
    cv.imshow('img',img)
    cv.waitKey(0)
def show2(img):#利用matplotlib显示图像
    plt.imshow(img[:, :, ::-1])
    plt.title('sese'), plt.xticks([]), plt.yticks([])
    plt.show()
def move():#图像移动
    M=M=np.float32([[1,0,100],[0,1,50]])#平移矩阵
    dst=cv.warpAffine(img1,M,(cols,rows))
    return dst
def rotateget(center,angel,scale):#获取图像旋转参数
   M=cv.getRotationMatrix2D(center,angel,scale)
   return M
def rotate(center,angel,scale):#图像旋转
    dst=cv.warpAffine(img1,rotateget(center,angel,scale),(cols,rows))
    return dst
if __name__=="__main__":
    show2(read())
    show2(rotate((cols/2,rows/2),90,1))
